
/**
 * generic LinkedList implementation
 * @param <T> Generic type.
 * @author Lukas Koell
 * @author David Medenjak
 * @author Johannes Riedmann
 */
public class LinkedItem<T> {

    /**
     * Value of the element.
     */
    private T value;
    /**
     * Next and previous element of the List, or null if there isn't one.
     */
    private LinkedItem<T> next;
    private LinkedItem<T> prev;

    /**
     * creates a new LinkedItem with a value of type T
     * @param value
     */
    public LinkedItem(T value) {
        this.value = value;
        this.next = null;
        this.prev = null;
    }

    /**
     * sets the next item in the list
     * @param next
     */
    public void setNext(LinkedItem<T> next) {
        this.next = next;
    }

    /**
     * @return the next item in the list
     */
    public LinkedItem<T> getNext() {
        return next;
    }

    /**
     * sets the previous item in the list
     * @param prev
     */
    public void setPrevious(LinkedItem<T> prev) {
        this.prev = prev;
    }

    /**
     * @return the previous item in the list
     */
    public LinkedItem<T> getPrevious() {
        return prev;
    }

    /**
     * @return this LinkedItems value
     */
    public T getValue() {
        return value;
    }
}
